home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Slots.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  13.9 KB  |  496 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Slots.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __SLOTS__
  18. #define __SLOTS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29. /*    #include <Quickdraw.h>                                        */
  30. /*        #include <MixedMode.h>                                    */
  31. /*        #include <QuickdrawText.h>                                */
  32. /*    #include <OSUtils.h>                                        */
  33.  
  34. #ifndef __FILES__
  35. #include <Files.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if GENERATINGPOWERPC
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #ifdef __CFM68K__
  47. #pragma lib_export on
  48. #endif
  49.  
  50.  
  51. enum {
  52.     fCardIsChanged                = 1,                            /*Card is Changed field in StatusFlags field of sInfoArray*/
  53.     fCkForSame                    = 0,                            /*For SearchSRT. Flag to check for SAME sResource in the table. */
  54.     fCkForNext                    = 1,                            /*For SearchSRT. Flag to check for NEXT sResource in the table. */
  55.     fWarmStart                    = 2,                            /*If this bit is set then warm start else cold start.*/
  56.     stateNil                    = 0,                            /*State*/
  57.     stateSDMInit                = 1,                            /*:Slot declaration manager Init*/
  58.     statePRAMInit                = 2,                            /*:sPRAM record init*/
  59.     statePInit                    = 3,                            /*:Primary init*/
  60.     stateSInit                    = 4,                            /*:Secondary init*/
  61. /* flags for spParamData */
  62.     fall                        = 0,                            /* bit 0: set=search enabled/disabled sRsrc's */
  63.     foneslot                    = 1,                            /*    1: set=search sRsrc's in given slot only */
  64.     fnext                        = 2                                /*    2: set=search for next sRsrc */
  65. };
  66.  
  67. /*
  68.         SlotIntServiceProcPtr uses register based parameters on the 68k and cannot
  69.         be written in or called from a high-level language without the help of
  70.         mixed mode or assembly glue.
  71.  
  72.         In:
  73.          => sqParameter     A1.L
  74.         Out:
  75.          <= return value    D0.W
  76. */
  77.  
  78. #if GENERATINGCFM
  79. typedef UniversalProcPtr SlotIntServiceUPP;
  80. #else
  81. typedef Register68kProcPtr SlotIntServiceUPP;
  82. #endif
  83.  
  84. enum {
  85.     uppSlotIntServiceProcInfo = kRegisterBased
  86.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  87.          | REGISTER_RESULT_LOCATION(kRegisterD0)
  88.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA1, SIZE_CODE(sizeof(long)))
  89. };
  90.  
  91. #if GENERATINGCFM
  92. #define NewSlotIntServiceProc(userRoutine)        \
  93.         (SlotIntServiceUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSlotIntServiceProcInfo, GetCurrentArchitecture())
  94. #else
  95. #define NewSlotIntServiceProc(userRoutine)        \
  96.         ((SlotIntServiceUPP) (userRoutine))
  97. #endif
  98.  
  99. #if GENERATINGCFM
  100. #define CallSlotIntServiceProc(userRoutine, sqParameter)        \
  101.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSlotIntServiceProcInfo, (sqParameter))
  102. #else
  103. /* (*SlotIntServiceProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  104. #endif
  105.  
  106. struct SlotIntQElement {
  107.     Ptr                                sqLink;                        /*ptr to next element*/
  108.     short                            sqType;                        /*queue type ID for validity*/
  109.     short                            sqPrio;                        /*priority*/
  110.     SlotIntServiceUPP                sqAddr;                        /*interrupt service routine*/
  111.     long                            sqParm;                        /*optional A1 parameter*/
  112. };
  113. typedef struct SlotIntQElement SlotIntQElement;
  114.  
  115. typedef SlotIntQElement *SQElemPtr;
  116.  
  117. struct SpBlock {
  118.     long                            spResult;                    /*FUNCTION Result*/
  119.     Ptr                                spsPointer;                    /*structure pointer*/
  120.     long                            spSize;                        /*size of structure*/
  121.     long                            spOffsetData;                /*offset/data field used by sOffsetData*/
  122.     Ptr                                spIOFileName;                /*ptr to IOFile name for sDisDrvrName*/
  123.     Ptr                                spsExecPBlk;                /*pointer to sExec parameter block.*/
  124.     long                            spParamData;                /*misc parameter data (formerly spStackPtr).*/
  125.     long                            spMisc;                        /*misc field for SDM.*/
  126.     long                            spReserved;                    /*reserved for future expansion*/
  127.     short                            spIOReserved;                /*Reserved field of Slot Resource Table*/
  128.     short                            spRefNum;                    /*RefNum*/
  129.     short                            spCategory;                    /*sType: Category*/
  130.     short                            spCType;                    /*Type*/
  131.     short                            spDrvrSW;                    /*DrvrSW*/
  132.     short                            spDrvrHW;                    /*DrvrHW*/
  133.     SInt8                            spTBMask;                    /*type bit mask bits 0..3 mask words 0..3*/
  134.     SInt8                            spSlot;                        /*slot number*/
  135.     SInt8                            spID;                        /*structure ID*/
  136.     SInt8                            spExtDev;                    /*ID of the external device*/
  137.     SInt8                            spHwDev;                    /*Id of the hardware device.*/
  138.     SInt8                            spByteLanes;                /*bytelanes from card ROM format block*/
  139.     SInt8                            spFlags;                    /*standard flags*/
  140.     SInt8                            spKey;                        /*Internal use only*/
  141. };
  142. typedef struct SpBlock SpBlock;
  143.  
  144. typedef SpBlock *SpBlockPtr;
  145.  
  146. struct SInfoRecord {
  147.     Ptr                                siDirPtr;                    /*Pointer to directory*/
  148.     short                            siInitStatusA;                /*initialization E*/
  149.     short                            siInitStatusV;                /*status returned by vendor init code*/
  150.     SInt8                            siState;                    /*initialization state*/
  151.     SInt8                            siCPUByteLanes;                /*0=[d0..d7] 1=[d8..d15]*/
  152.     SInt8                            siTopOfROM;                    /*Top of ROM= $FssFFFFx: x is TopOfROM*/
  153.     SInt8                            siStatusFlags;                /*bit 0 - card is changed*/
  154.     short                            siTOConst;                    /*Time Out C for BusErr*/
  155.     SInt8                            siReserved[2];                /*reserved*/
  156.     Ptr                                siROMAddr;                    /* addr of top of ROM */
  157.     SInt8                            siSlot;                        /* slot number */
  158.     SInt8                            siPadding[3];                /* reserved */
  159. };
  160. typedef struct SInfoRecord SInfoRecord;
  161.  
  162. typedef SInfoRecord *SInfoRecPtr;
  163.  
  164. struct SDMRecord {
  165.     ProcPtr                            sdBEVSave;                    /*Save old BusErr vector*/
  166.     ProcPtr                            sdBusErrProc;                /*Go here to determine if it is a BusErr*/
  167.     ProcPtr                            sdErrorEntry;                /*Go here if BusErrProc finds real BusErr*/
  168.     long                            sdReserved;                    /*Reserved*/
  169. };
  170. typedef struct SDMRecord SDMRecord;
  171.  
  172. struct FHeaderRec {
  173.     long                            fhDirOffset;                /*offset to directory*/
  174.     long                            fhLength;                    /*length of ROM*/
  175.     long                            fhCRC;                        /*CRC*/
  176.     SInt8                            fhROMRev;                    /*revision of ROM*/
  177.     SInt8                            fhFormat;                    /*format - 2*/
  178.     long                            fhTstPat;                    /*test pattern*/
  179.     SInt8                            fhReserved;                    /*reserved*/
  180.     SInt8                            fhByteLanes;                /*ByteLanes*/
  181. };
  182. typedef struct FHeaderRec FHeaderRec;
  183.  
  184. typedef FHeaderRec *FHeaderRecPtr;
  185.  
  186. struct SEBlock {
  187.     UInt8                            seSlot;                        /*Slot number.*/
  188.     UInt8                            sesRsrcId;                    /*sResource Id.*/
  189.     short                            seStatus;                    /*Status of code executed by sExec.*/
  190.     UInt8                            seFlags;                    /*Flags*/
  191.     UInt8                            seFiller0;                    /*Filler, must be SignedByte to align on odd boundry*/
  192.     UInt8                            seFiller1;                    /*Filler*/
  193.     UInt8                            seFiller2;                    /*Filler*/
  194.     long                            seResult;                    /*Result of sLoad.*/
  195.     long                            seIOFileName;                /*Pointer to IOFile name.*/
  196.     UInt8                            seDevice;                    /*Which device to read from.*/
  197.     UInt8                            sePartition;                /*The partition.*/
  198.     UInt8                            seOSType;                    /*Type of OS.*/
  199.     UInt8                            seReserved;                    /*Reserved field.*/
  200.     UInt8                            seRefNum;                    /*RefNum of the driver.*/
  201.     UInt8                            seNumDevices;                /* Number of devices to load.*/
  202.     UInt8                            seBootState;                /*State of StartBoot code.*/
  203.     SInt8                            filler;
  204. };
  205. typedef struct SEBlock SEBlock;
  206.  
  207. /*  Principle  */
  208.  
  209. #if !GENERATINGCFM
  210. #pragma parameter __D0 SReadByte(__A0)
  211. #endif
  212. extern pascal OSErr SReadByte(SpBlockPtr spBlkPtr)
  213.  TWOWORDINLINE(0x7000, 0xA06E);
  214.  
  215. #if !GENERATINGCFM
  216. #pragma parameter __D0 SReadWord(__A0)
  217. #endif
  218. extern pascal OSErr SReadWord(SpBlockPtr spBlkPtr)
  219.  TWOWORDINLINE(0x7001, 0xA06E);
  220.  
  221. #if !GENERATINGCFM
  222. #pragma parameter __D0 SReadLong(__A0)
  223. #endif
  224. extern pascal OSErr SReadLong(SpBlockPtr spBlkPtr)
  225.  TWOWORDINLINE(0x7002, 0xA06E);
  226.  
  227. #if !GENERATINGCFM
  228. #pragma parameter __D0 SGetCString(__A0)
  229. #endif
  230. extern pascal OSErr SGetCString(SpBlockPtr spBlkPtr)
  231.  TWOWORDINLINE(0x7003, 0xA06E);
  232.  
  233. #if !GENERATINGCFM
  234. #pragma parameter __D0 SGetBlock(__A0)
  235. #endif
  236. extern pascal OSErr SGetBlock(SpBlockPtr spBlkPtr)
  237.  TWOWORDINLINE(0x7005, 0xA06E);
  238.  
  239. #if !GENERATINGCFM
  240. #pragma parameter __D0 SFindStruct(__A0)
  241. #endif
  242. extern pascal OSErr SFindStruct(SpBlockPtr spBlkPtr)
  243.  TWOWORDINLINE(0x7006, 0xA06E);
  244.  
  245. #if !GENERATINGCFM
  246. #pragma parameter __D0 SReadStruct(__A0)
  247. #endif
  248. extern pascal OSErr SReadStruct(SpBlockPtr spBlkPtr)
  249.  TWOWORDINLINE(0x7007, 0xA06E);
  250. /*  Special  */
  251.  
  252. #if !GENERATINGCFM
  253. #pragma parameter __D0 SReadInfo(__A0)
  254. #endif
  255. extern pascal OSErr SReadInfo(SpBlockPtr spBlkPtr)
  256.  TWOWORDINLINE(0x7010, 0xA06E);
  257.  
  258. #if !GENERATINGCFM
  259. #pragma parameter __D0 SReadPRAMRec(__A0)
  260. #endif
  261. extern pascal OSErr SReadPRAMRec(SpBlockPtr spBlkPtr)
  262.  TWOWORDINLINE(0x7011, 0xA06E);
  263.  
  264. #if !GENERATINGCFM
  265. #pragma parameter __D0 SPutPRAMRec(__A0)
  266. #endif
  267. extern pascal OSErr SPutPRAMRec(SpBlockPtr spBlkPtr)
  268.  TWOWORDINLINE(0x7012, 0xA06E);
  269.  
  270. #if !GENERATINGCFM
  271. #pragma parameter __D0 SReadFHeader(__A0)
  272. #endif
  273. extern pascal OSErr SReadFHeader(SpBlockPtr spBlkPtr)
  274.  TWOWORDINLINE(0x7013, 0xA06E);
  275.  
  276. #if !GENERATINGCFM
  277. #pragma parameter __D0 SNextSRsrc(__A0)
  278. #endif
  279. extern pascal OSErr SNextSRsrc(SpBlockPtr spBlkPtr)
  280.  TWOWORDINLINE(0x7014, 0xA06E);
  281.  
  282. #if !GENERATINGCFM
  283. #pragma parameter __D0 SNextTypeSRsrc(__A0)
  284. #endif
  285. extern pascal OSErr SNextTypeSRsrc(SpBlockPtr spBlkPtr)
  286.  TWOWORDINLINE(0x7015, 0xA06E);
  287.  
  288. #if !GENERATINGCFM
  289. #pragma parameter __D0 SRsrcInfo(__A0)
  290. #endif
  291. extern pascal OSErr SRsrcInfo(SpBlockPtr spBlkPtr)
  292.  TWOWORDINLINE(0x7016, 0xA06E);
  293.  
  294. #if !GENERATINGCFM
  295. #pragma parameter __D0 SCkCardStat(__A0)
  296. #endif
  297. extern pascal OSErr SCkCardStat(SpBlockPtr spBlkPtr)
  298.  TWOWORDINLINE(0x7018, 0xA06E);
  299.  
  300. #if !GENERATINGCFM
  301. #pragma parameter __D0 SReadDrvrName(__A0)
  302. #endif
  303. extern pascal OSErr SReadDrvrName(SpBlockPtr spBlkPtr)
  304.  TWOWORDINLINE(0x7019, 0xA06E);
  305.  
  306. #if !GENERATINGCFM
  307. #pragma parameter __D0 SFindDevBase(__A0)
  308. #endif
  309. extern pascal OSErr SFindDevBase(SpBlockPtr spBlkPtr)
  310.  TWOWORDINLINE(0x701B, 0xA06E);
  311.  
  312. #if !GENERATINGCFM
  313. #pragma parameter __D0 SFindBigDevBase(__A0)
  314. #endif
  315. extern pascal OSErr SFindBigDevBase(SpBlockPtr spBlkPtr)
  316.  TWOWORDINLINE(0x701C, 0xA06E);
  317. /*  Advanced  */
  318.  
  319. #if !GENERATINGCFM
  320. #pragma parameter __D0 InitSDeclMgr(__A0)
  321. #endif
  322. extern pascal OSErr InitSDeclMgr(SpBlockPtr spBlkPtr)
  323.  TWOWORDINLINE(0x7020, 0xA06E);
  324.  
  325. #if !GENERATINGCFM
  326. #pragma parameter __D0 SPrimaryInit(__A0)
  327. #endif
  328. extern pascal OSErr SPrimaryInit(SpBlockPtr spBlkPtr)
  329.  TWOWORDINLINE(0x7021, 0xA06E);
  330.  
  331. #if !GENERATINGCFM
  332. #pragma parameter __D0 SCardChanged(__A0)
  333. #endif
  334. extern pascal OSErr SCardChanged(SpBlockPtr spBlkPtr)
  335.  TWOWORDINLINE(0x7022, 0xA06E);
  336.  
  337. #if !GENERATINGCFM
  338. #pragma parameter __D0 SExec(__A0)
  339. #endif
  340. extern pascal OSErr SExec(SpBlockPtr spBlkPtr)
  341.  TWOWORDINLINE(0x7023, 0xA06E);
  342.  
  343. #if !GENERATINGCFM
  344. #pragma parameter __D0 SOffsetData(__A0)
  345. #endif
  346. extern pascal OSErr SOffsetData(SpBlockPtr spBlkPtr)
  347.  TWOWORDINLINE(0x7024, 0xA06E);
  348.  
  349. #if !GENERATINGCFM
  350. #pragma parameter __D0 SInitPRAMRecs(__A0)
  351. #endif
  352. extern pascal OSErr SInitPRAMRecs(SpBlockPtr spBlkPtr)
  353.  TWOWORDINLINE(0x7025, 0xA06E);
  354.  
  355. #if !GENERATINGCFM
  356. #pragma parameter __D0 SReadPBSize(__A0)
  357. #endif
  358. extern pascal OSErr SReadPBSize(SpBlockPtr spBlkPtr)
  359.  TWOWORDINLINE(0x7026, 0xA06E);
  360.  
  361. #if !GENERATINGCFM
  362. #pragma parameter __D0 SCalcStep(__A0)
  363. #endif
  364. extern pascal OSErr SCalcStep(SpBlockPtr spBlkPtr)
  365.  TWOWORDINLINE(0x7028, 0xA06E);
  366.  
  367. #if !GENERATINGCFM
  368. #pragma parameter __D0 SInitSRsrcTable(__A0)
  369. #endif
  370. extern pascal OSErr SInitSRsrcTable(SpBlockPtr spBlkPtr)
  371.  TWOWORDINLINE(0x7029, 0xA06E);
  372.  
  373. #if !GENERATINGCFM
  374. #pragma parameter __D0 SSearchSRT(__A0)
  375. #endif
  376. extern pascal OSErr SSearchSRT(SpBlockPtr spBlkPtr)
  377.  TWOWORDINLINE(0x702A, 0xA06E);
  378.  
  379. #if !GENERATINGCFM
  380. #pragma parameter __D0 SUpdateSRT(__A0)
  381. #endif
  382. extern pascal OSErr SUpdateSRT(SpBlockPtr spBlkPtr)
  383.  TWOWORDINLINE(0x702B, 0xA06E);
  384.  
  385. #if !GENERATINGCFM
  386. #pragma parameter __D0 SCalcSPointer(__A0)
  387. #endif
  388. extern pascal OSErr SCalcSPointer(SpBlockPtr spBlkPtr)
  389.  TWOWORDINLINE(0x702C, 0xA06E);
  390.  
  391. #if !GENERATINGCFM
  392. #pragma parameter __D0 SGetDriver(__A0)
  393. #endif
  394. extern pascal OSErr SGetDriver(SpBlockPtr spBlkPtr)
  395.  TWOWORDINLINE(0x702D, 0xA06E);
  396.  
  397. #if !GENERATINGCFM
  398. #pragma parameter __D0 SPtrToSlot(__A0)
  399. #endif
  400. extern pascal OSErr SPtrToSlot(SpBlockPtr spBlkPtr)
  401.  TWOWORDINLINE(0x702E, 0xA06E);
  402.  
  403. #if !GENERATINGCFM
  404. #pragma parameter __D0 SFindSInfoRecPtr(__A0)
  405. #endif
  406. extern pascal OSErr SFindSInfoRecPtr(SpBlockPtr spBlkPtr)
  407.  TWOWORDINLINE(0x702F, 0xA06E);
  408.  
  409. #if !GENERATINGCFM
  410. #pragma parameter __D0 SFindSRsrcPtr(__A0)
  411. #endif
  412. extern pascal OSErr SFindSRsrcPtr(SpBlockPtr spBlkPtr)
  413.  TWOWORDINLINE(0x7030, 0xA06E);
  414.  
  415. #if !GENERATINGCFM
  416. #pragma parameter __D0 SDeleteSRTRec(__A0)
  417. #endif
  418. extern pascal OSErr SDeleteSRTRec(SpBlockPtr spBlkPtr)
  419.  TWOWORDINLINE(0x7031, 0xA06E);
  420. extern pascal OSErr OpenSlot(ParmBlkPtr paramBlock, Boolean async);
  421.  
  422. #if !GENERATINGCFM
  423. #pragma parameter __D0 OpenSlotSync(__A0)
  424. #endif
  425. extern pascal OSErr OpenSlotSync(ParmBlkPtr paramBlock)
  426.  ONEWORDINLINE(0xA200);
  427.  
  428. #if !GENERATINGCFM
  429. #pragma parameter __D0 OpenSlotAsync(__A0)
  430. #endif
  431. extern pascal OSErr OpenSlotAsync(ParmBlkPtr paramBlock)
  432.  ONEWORDINLINE(0xA600);
  433. /*  Device Manager Slot Support  */
  434.  
  435. #if !GENERATINGCFM
  436. #pragma parameter __D0 SIntInstall(__A0, __D0)
  437. #endif
  438. extern pascal OSErr SIntInstall(SQElemPtr sIntQElemPtr, short theSlot)
  439.  ONEWORDINLINE(0xA075);
  440.  
  441. #if !GENERATINGCFM
  442. #pragma parameter __D0 SIntRemove(__A0, __D0)
  443. #endif
  444. extern pascal OSErr SIntRemove(SQElemPtr sIntQElemPtr, short theSlot)
  445.  ONEWORDINLINE(0xA076);
  446.  
  447. #if !GENERATINGCFM
  448. #pragma parameter __D0 SVersion(__A0)
  449. #endif
  450. extern pascal OSErr SVersion(SpBlockPtr spBlkPtr)
  451.  TWOWORDINLINE(0x7008, 0xA06E);
  452.  
  453. #if !GENERATINGCFM
  454. #pragma parameter __D0 SetSRsrcState(__A0)
  455. #endif
  456. extern pascal OSErr SetSRsrcState(SpBlockPtr spBlkPtr)
  457.  TWOWORDINLINE(0x7009, 0xA06E);
  458.  
  459. #if !GENERATINGCFM
  460. #pragma parameter __D0 InsertSRTRec(__A0)
  461. #endif
  462. extern pascal OSErr InsertSRTRec(SpBlockPtr spBlkPtr)
  463.  TWOWORDINLINE(0x700A, 0xA06E);
  464.  
  465. #if !GENERATINGCFM
  466. #pragma parameter __D0 SGetSRsrc(__A0)
  467. #endif
  468. extern pascal OSErr SGetSRsrc(SpBlockPtr spBlkPtr)
  469.  TWOWORDINLINE(0x700B, 0xA06E);
  470.  
  471. #if !GENERATINGCFM
  472. #pragma parameter __D0 SGetTypeSRsrc(__A0)
  473. #endif
  474. extern pascal OSErr SGetTypeSRsrc(SpBlockPtr spBlkPtr)
  475.  TWOWORDINLINE(0x700C, 0xA06E);
  476.  
  477. #if !GENERATINGCFM
  478. #pragma parameter __D0 SGetSRsrcPtr(__A0)
  479. #endif
  480. extern pascal OSErr SGetSRsrcPtr(SpBlockPtr spBlkPtr)
  481.  TWOWORDINLINE(0x701D, 0xA06E);
  482.  
  483. #ifdef __CFM68K__
  484. #pragma lib_export off
  485. #endif
  486.  
  487. #if GENERATINGPOWERPC
  488. #pragma options align=reset
  489. #endif
  490.  
  491. #ifdef __cplusplus
  492. }
  493. #endif
  494.  
  495. #endif /* __SLOTS__ */
  496.